var goods_url = "/goods/";

lvan.m.addGoods = function() {
	addGoods_obj = extend(module,{
		id: "addGoods",
		html:"<div id=\"addGoods\" class=\"mainblock\"><form id='addGoodsForm'><div class='lpanel'><input type='hidden' name='goodsId'/><div class='flabel'>名称</div><div class='ffield'><input name='goodsName' type='text'/></div>" +
				"<div class='flabel'>拼音</div><div class='ffield'><input name='goodsPy' type='text'/></div>" +
				"<div class='flabel'>助记码</div><div class='ffield'><input name='assCode' type='text'/></div>" +
				"<div class='flabel'>规格</div><div class='ffield'><input name='goodsSpec' type='text'/></div>" +
				"<div class='flabel'>单位</div><div class='ffield'><input name='goodsUnit' type='text'/></div>" +
				"<div class='flabel'>价格1</div><div class='ffield'>"+numEl('goodsPrice1')+"</div>" +
				"<div class='flabel'>价格2</div><div class='ffield'>"+numEl('goodsPrice2')+"</div></div>" +
				
				"<div class='rpanel'><div class='flabel'>产品</div><div class='ffield'>"+productHTML("goodsProduct")+"<img src='/image/modify.png'/><img src='/image/add.png'/><img src='/image/refresh.png'/></div>" +
				"<div class='flabel'>类别</div><div class='ffield'>"+goodsTypetHTML("goodsType")+"<img src='/image/modify.png'/><img src='/image/add.png'/><img src='/image/refresh.png'/><input name='goodsTypeName' type='hidden'/></div>" +
				"<div class='flabel'>条码</div><div class='ffield'><input name='barCode'/ type='text'></div>" +
				"<div class='flabel'>单价</div><div class='ffield'>"+numEl("goodsPrice")+"</div>" +
				"<div class='flabel'>成本</div><div class='ffield'>"+numEl("goodsCurrentCost")+"</div>" +
				"<div class='flabel'>条件1</div><div class='ffield'><input name='goodsPrice1Condition' type='text'/></div>" +
				"<div class='flabel'>条件2</div><div class='ffield'><input name='goodsPrice2Condition' type='text'/></div></div>" +
				"<div class='fbutton'><input value='提交' type='button' onclick='addGoods_obj.sub();'/></div></form></div>",
		sub: function() {
			if(jQuery('input[name=goodsName]',"#addGoods").val()==''){alert('商品名称不能为空');return false;}
			var goodsName = jQuery('input[name=goodsName]',"#addGoods").val();
			var goodsPy = jQuery('input[name=goodsPy]',"#addGoods").val();
			var goodsPrice = jQuery('input[name=goodsPrice]',"#addGoods").val();
			var goodsProduct = jQuery('select[name=goodsProduct]',"#addGoods").val();
			var goodsType = jQuery('select[name=goodsType]',"#addGoods").val();
			var assCode = jQuery('input[name=assCode]',"#addGoods").val();
			var goodsSpec = jQuery('input[name=goodsSpec]',"#addGoods").val();
			var goodsUnit = jQuery('input[name=goodsUnit]',"#addGoods").val();
			var goodsPrice1 = jQuery('input[name=goodsPrice1]',"#addGoods").val();
			var goodsPrice2 = jQuery('input[name=goodsPrice2]',"#addGoods").val();
			var barCode = jQuery('input[name=barCode]',"#addGoods").val();
			var goodsCurrentCost = jQuery('input[name=goodsCurrentCost]',"#addGoods").val();
			var goodsPrice1Condition = jQuery('input[name=goodsPrice1Condition]',"#addGoods").val();
			var goodsPrice2Condition = jQuery('input[name=goodsPrice2Condition]',"#addGoods").val();
	
			req(goods_url+"add",{"goodsName":goodsName,"goodsPy":goodsPy,"goodsPrice":goodsPrice,"goodsType":goodsType,"goodsProduct":goodsProduct},function(t) {
				alert("成功！");
			});
		}
	});
	addGoods_obj.init();
};

function queryGoods() {
	
}
function goodsType() {
	//alert("goodsType");
}